<template>
	<!-- 帮助中心 -->
	<view class="container" v-if="isloding">
		<image src="../../static/help.png" mode=""></image>
		<view class="content">
			<view class="title">
				您可能遇到的问题
			</view>
			<view class="item" @tap="goAnswer(item.id)" v-for="item in info.list" :key="item.id">
				<view class="text">
					{{item.question}}
				</view>
				<image src="../../static/icon/you.png" mode=""></image>
			</view>
		</view>
		<view class="btn" @tap="boda">
			联系客服
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token:'',
				info:'',
				phone:0,
				isloding:false
			};
		},
		onLoad(e) {
			this.token=e.token
			uni.showLoading({
				title: '加载中',
				mask: false
			});
			uni.request({
				url: this.webUrl+'/user/my/problem',
				method: 'GET',
				header:{
					token:e.token
				},
				data: {
					page:1
				},
				success: res => {
					console.log(res)
					uni.hideLoading()
					if(res.data.code==0){
						this.info=res.data.data
						this.phone=res.data.data.phone.phone
					}else if(res.data.code==3){
						uni.showToast({
							title: res.data.msg,
							icon:'none',
							duration:2000
						});
					}else{
						uni.showToast({
							title: '网络错误',
							icon:'none',
							duration:2000
						});
					}
					this.isloding=true
				},
				fail: () => {},
				complete: () => {}
			});
		},
		methods:{
			boda(){
				uni.makePhoneCall({
				    phoneNumber: this.phone //仅为示例
				});
			},
			goAnswer(id){
				// console.log(id)
				uni.navigateTo({
					url: 'Answer/Answer?id='+id+'&token='+this.token,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style lang="scss">
	uni-page-body{
		height: 100%;
	}
	page{
		height: 100%;
	}
	.container{
		position: absolute;
		left: 0;
		bottom: 0;
		top: 0;
		right: 0;
		background: #f2f2f2;
		image{
			width: 100%;
			height: 300upx;
		}
		.content{
			margin-top: 30upx;
			background: #FFFFFF;
			.title{
				width: 90%;
				height: 60upx;
				background: #fd764b;
				border-bottom-right-radius: 30upx;
				border-top-right-radius: 30upx;
				color: #FFFFFF;
				line-height: 60upx;
				font-size: 28upx;
				padding-left: 30upx;
			}
			.item{
				display: flex;
				justify-content: space-between;
				border-bottom: 2upx solid #f2f2f2;
				margin: 20upx 30upx 0;
				padding-bottom: 20upx;
				font-size: 28upx;
				image{
					width: 14upx;
					height: 24upx;
				}
			}
		}
		.btn{
			position: absolute;
			bottom: 0;
			height: 100upx;
			width: 100%;
			background: #fd764b;
			font-size: 38upx;
			color: #FFFFFF;
			text-align: center;
			line-height: 100upx;
		}
	}
</style>
